package com.chengxiaoxiao.ai_demo.config;

/**
 * 知识库容器
 *
 * @Description:
 * @Author Cheng Xiaoxiao
 * @Date: 2025/4/3 10:54
 */
public class KnowledgeThreadLocal {
    private static final ThreadLocal<String> KNOWLEDGE_BASE_ID = new ThreadLocal<>();

    /**
     * 获取知识库ID
     *
     * @return 知识库ID
     */
    public static String getKnowledgeBaseId() {
        return KNOWLEDGE_BASE_ID.get();
    }

    /**
     * 设置知识库ID
     *
     * @param id 知识库ID
     */
    public static void setKnowledgeBaseId(String id) {
        KNOWLEDGE_BASE_ID.set(id);
    }

    /**
     * 移除知识库ID
     */
    public static void removeKnowledgeBaseId() {
        KNOWLEDGE_BASE_ID.remove();
    }
}
